﻿// See https://aka.ms/new-console-template for more information
using static System.Console;

Title = "C#中is和as";

//is关键字用于检查对象的类型是否与给定类型兼容

object obj = new object();
string str = "buer";
if (str is object)
{
    WriteLine("判断是否兼容：true");
}
else
{
    WriteLine("判断是否兼容：false");
}

int a = 1;
double d = 0.2;
if(a is int)
{
    WriteLine("判断是否兼容：true");
}
else
{
    WriteLine("判断是否兼容：false");
}






//as用于兼容的引用类型之间的转换










ReadKey();

